// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   KindDeep.java

package include.nseer_cookie;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;

public class KindDeep
{

	public KindDeep()
	{
	}

	public static int getDeep(String chain_id, int first_length, int step_length)
	{
		int deep = 1;
		chain_id = chain_id.substring(first_length);
		deep += chain_id.length() / step_length;
		return deep;
	}

	public static String getPre(String dbase)
	{
		String pre = "###,##0.";
		try
		{
			int pre_control = 0;
			nseer_db erp_db = new nseer_db(dbase);
			String sql = "select type_name from erpplatform_config_public_char where kind='nseer_define'";
			ResultSet rs = erp_db.executeQuery(sql);
			if (rs.next())
				pre_control = Integer.parseInt(rs.getString("type_name").substring(9));
			erp_db.close();
			for (int i = 0; i < pre_control; i++)
				pre = (new StringBuilder(String.valueOf(pre))).append("0").toString();

		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return pre;
	}

	public static String getAmountPre(String dbase)
	{
		String pre = "#####0.";
		try
		{
			int pre_control = 0;
			nseer_db erp_db = new nseer_db(dbase);
			String sql = "select type_name from erpplatform_config_public_char where kind='nseer_define'";
			ResultSet rs = erp_db.executeQuery(sql);
			if (rs.next())
				pre_control = Integer.parseInt(rs.getString("type_name").substring(9));
			erp_db.close();
			for (int i = 0; i < pre_control; i++)
				pre = (new StringBuilder(String.valueOf(pre))).append("0").toString();

		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return pre;
	}
}
